/*
 *  Copyright 2009 Coditate Software
 *  Licensed under the GNU Library General Public License (LGPL) 2.1 
 *  
 *  License available at: http://simplesavant.codeplex.com/license
 */
using System;

namespace Coditate.Savant
{
    /// <summary>
    /// Supports storage of large property values by spanning multiple SimpleDB attributes.
    /// </summary>
    /// <remarks>
    /// Use this attribute on string properties to store values larger than the SimpleDB limit
    /// of 1024 characters per attribute.
    /// 
    /// <para>
    /// Spanned properties may be up to 261,376 characters in length, depending on whether the item 
    /// contains any other properties. This limit is derived from the SimpleDB limits of 1024 characters per attribute x 256 attributes per item
    /// with 768 characters used in overhead. This limit can be increased further by enabling compression, which may allow storage of properties as large as .5 MB. 
    /// </para>
    /// </remarks>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class SpanAttribute : SavantAttribute
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SpanAttribute"/> class.
        /// </summary>
        /// <param name="compress">if set to <c>true</c> compress the data.</param>
        public SpanAttribute(bool compress)
        {
            Compress = compress;
        }

        /// <summary>
        /// Gets or sets a value indicating whether data should be compressed when stored in SimpleDB.
        /// </summary>
        /// <value><c>true</c> if data should be compressed; otherwise, <c>false</c>.</value>
        public bool Compress { get; private set; }
    }
}